package leecode

func trainWays(num int) int {
	if num == 0 || num == 1 {
		return 1
	}
	dp := make([]int, num+1)
	dp[0] = 1
	dp[1] = 1
	dp[2] = 2
	for i := 3; i <= num; i++ {
		dp[i] = (dp[i-1] % (1e9 + 7)) + (dp[i-2] % (1e9 + 7))
	}
	return dp[len(dp)-1] % (1e9 + 7)
}
